﻿using System;
using System.Collections.Generic;
using UnityEngine.Events;

// Token: 0x0200063C RID: 1596
public static class NullCheck
{
	// Token: 0x06002623 RID: 9763 RVA: 0x00146928 File Offset: 0x00144B28
	public static bool IsNullOrWhiteSpace(this string self)
	{
		return self == null || self.Trim() == string.Empty;
	}

	// Token: 0x06002624 RID: 9764 RVA: 0x00146944 File Offset: 0x00144B44
	public static bool IsNullOrEmpty(this string self)
	{
		return string.IsNullOrEmpty(self);
	}

	// Token: 0x06002625 RID: 9765 RVA: 0x0014694C File Offset: 0x00144B4C
	public static bool IsNullOrEmpty<T>(this IList<T> self)
	{
		return self == null || self.Count == 0;
	}

	// Token: 0x06002626 RID: 9766 RVA: 0x00146960 File Offset: 0x00144B60
	public static bool IsNullOrEmpty<T>(this List<T> self)
	{
		return self == null || self.Count == 0;
	}

	// Token: 0x06002627 RID: 9767 RVA: 0x00146974 File Offset: 0x00144B74
	public static bool IsNullOrEmpty(this MulticastDelegate self)
	{
		return self == null || self.GetInvocationList() == null || self.GetInvocationList().Length == 0;
	}

	// Token: 0x06002628 RID: 9768 RVA: 0x00146998 File Offset: 0x00144B98
	public static bool IsNullOrEmpty(this UnityEvent self)
	{
		return self == null || self.GetPersistentEventCount() == 0;
	}

	// Token: 0x06002629 RID: 9769 RVA: 0x001469AC File Offset: 0x00144BAC
	public static bool IsNullOrEmpty(this UnityEvent self, int target)
	{
		return self.IsNullOrEmpty() || self.GetPersistentTarget(target) == null || self.GetPersistentMethodName(target).IsNullOrEmpty();
	}

	// Token: 0x0600262A RID: 9770 RVA: 0x001469DC File Offset: 0x00144BDC
	public static T SafeGet<T>(this T[] array, int index)
	{
		if ((ulong)index < (ulong)((long)array.Length))
		{
			return array[index];
		}
		return default(T);
	}

	// Token: 0x0600262B RID: 9771 RVA: 0x00146A08 File Offset: 0x00144C08
	public static T SafeGet<T>(this List<T> list, int index)
	{
		if ((ulong)index < (ulong)((long)list.Count))
		{
			return list[index];
		}
		return default(T);
	}

	// Token: 0x0600262C RID: 9772 RVA: 0x00146A34 File Offset: 0x00144C34
	public static bool SafeProc<T>(this T self, Action<T> act = null)
	{
		bool flag = self != null;
		if (flag)
		{
			act(self);
		}
		return flag;
	}

	// Token: 0x0600262D RID: 9773 RVA: 0x00146A5C File Offset: 0x00144C5C
	public static void Call(this Action action)
	{
		if (action != null)
		{
			action();
		}
	}

	// Token: 0x0600262E RID: 9774 RVA: 0x00146A6C File Offset: 0x00144C6C
	public static void Call<T>(this Action<T> action, T arg)
	{
		if (action != null)
		{
			action(arg);
		}
	}

	// Token: 0x0600262F RID: 9775 RVA: 0x00146A7C File Offset: 0x00144C7C
	public static void Call<T1, T2>(this Action<T1, T2> action, T1 arg1, T2 arg2)
	{
		if (action != null)
		{
			action(arg1, arg2);
		}
	}

	// Token: 0x06002630 RID: 9776 RVA: 0x00146A8C File Offset: 0x00144C8C
	public static void Call<T1, T2, T3>(this Action<T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3)
	{
		if (action != null)
		{
			action(arg1, arg2, arg3);
		}
	}

	// Token: 0x06002631 RID: 9777 RVA: 0x00146AA0 File Offset: 0x00144CA0
	public static TResult Call<TResult>(this Func<TResult> func, TResult result)
	{
		return (func == null) ? result : func();
	}

	// Token: 0x06002632 RID: 9778 RVA: 0x00146AB4 File Offset: 0x00144CB4
	public static TResult Call<T, TResult>(this Func<T, TResult> func, T arg, TResult result)
	{
		return (func == null) ? result : func(arg);
	}

	// Token: 0x06002633 RID: 9779 RVA: 0x00146ACC File Offset: 0x00144CCC
	public static TResult Call<T1, T2, TResult>(this Func<T1, T2, TResult> func, T1 arg1, T2 arg2, TResult result)
	{
		return (func == null) ? result : func(arg1, arg2);
	}

	// Token: 0x06002634 RID: 9780 RVA: 0x00146AE4 File Offset: 0x00144CE4
	public static TResult Call<T1, T2, T3, TResult>(this Func<T1, T2, T3, TResult> func, T1 arg1, T2 arg2, T3 arg3, TResult result)
	{
		return (func == null) ? result : func(arg1, arg2, arg3);
	}
}
